From 0b026f9926adaabac00231598e56403cb98064ac Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Wed, 11 Jul 2018 21:11:17 +0200 Subject: [PATCH] babl-space: add comments, do not use a static temp struct --- babl/babl-space.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/babl/babl-space.c b/babl/babl-space.c index 6e8774d..793ab7f 100644 --- a/babl/babl-space.c +++ b/babl/babl-space.c @@ -230,9 +230,12 @@ babl_space_from_rgbxyz_matrix (const char *name, const Babl *trc_blue) { int i=0; - static BablSpace space; + BablSpace space; space.instance.class_type = BABL_SPACE; space.instance.id = 0; + /* it would be better to reconstruct chromaticities - since they + * can be asked for with API + */ space.xr = rx; space.yr = gx; space.xg = bx; @@ -243,6 +246,7 @@ babl_space_from_rgbxyz_matrix (const char *name, space.yw = gz; space.pad = bz; + space.whitepoint[0] = wx; space.whitepoint[1] = wy; space.whitepoint[2] = wz; @@ -267,7 +271,9 @@ babl_space_from_rgbxyz_matrix (const char *name, return NULL; } /* transplant matrixes */ - //babl_space_compute_matrices (&space_db[i]); + + /* XXX: there is a potential race condition if making the same space in + multiple threads */ space.RGBtoXYZ[0] = rx; space.RGBtoXYZ[1] = gx; space.RGBtoXYZ[2] = bx; @@ -295,7 +301,6 @@ babl_space_from_rgbxyz_matrix (const char *name, babl_get_name (space.trc[0]), babl_get_name(space.trc[1]), babl_get_name(space.trc[2])); - return (Babl*)&space_db[i]; } -- 2.30.2